home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
LISTMANA
/
__TESTER
/
TESTERWI.C
< prev
next >
Wrap
Text File
|
1989-06-25
|
4KB
|
214 lines
/**** */
/**** Code Testing System version 1.0 (beta) */
/**** */
/**** All portions of this source code are the property of Jack */
/**** Herrington. I, Jack Herrington, give you permission to use */
/**** use or alter the code in any way that pleases you. You must */
/**** however return by whatever means avaliable any improvements */
/**** you believe significant to Jack Herrington, accepting that */
/**** these improvements might be contained in later releases of */
/**** the code. I also grant you permission to remove this header */
/**** from any file you are WORKING on, as long as you put it back */
/**** when you're stopped WORKING on it. */
/**** */
/**** Jack Herrington: University Of Miami, Biomedical Computing */
/**** 1600 N.W. 10th Ave. (R-53) */
/**** (305) 547-6538 */
/**** */
/****/
/**** Window handling routines */
/****/
#include "Tester.h"
/****/
/**** Create a new dialog */
/****/
int TesterDialogNew(resID,handler)
int resID;
int handler;
{
int y,win;
/**** Find open window slot */
win=(-1);
for(y=0;y<MAX_WINDOWS;y++)
{
if(Windows[y].window == 0L)win=y;
}
if(win==(-1))return (-1);
/**** Get the new dialog */
Windows[win].window = GetNewDialog(resID,Windows[win].wStorage,-1L);
if ( Windows[win].window == 0L ) return (-1);
Windows[win].handler = handler;
Windows[win].idle = Handlers[handler].idle;
/**** Setup the current */
CurWindow = win;
/**** Return the address */
return win;
}
/****/
/**** Find the window */
/****/
int TesterFindProgWindow(window)
WindowPtr window;
{
int win;
for(win=0;win<MAX_WINDOWS;win++)
if(Windows[win].window == window)return win;
return (-1);
}
/****/
/**** Allocate window data */
/****/
void TesterAllocateWindowData(size)
long size;
{
Windows[CurWindow].data = NewHandle((Size)size);
}
/****/
/**** Lock the current windows information */
/****/
void TesterLockWindowInfo()
{
HLock(Windows[CurWindow].data);
}
/****/
/**** Lock the current windows information from a window pointer */
/****/
void TesterLockWindowInfoWindow(window)
WindowPtr window;
{
int winNum;
winNum = TesterFindProgWindow(window);
HLock(Windows[winNum].data);
}
/****/
/**** Lock the current windows information from a window pointer */
/****/
void TesterUnLockWindowInfoWindow(window)
WindowPtr window;
{
int winNum;
winNum = TesterFindProgWindow(window);
HUnlock(Windows[winNum].data);
}
/****/
/**** Lock the a windows information */
/****/
void TesterLockWindowInfoNum(win)
int win;
{
HLock(Windows[win].data);
}
/****/
/**** UnLock the current windows information */
/****/
void TesterUnLockWindowInfo()
{
int win;
for(win=0;win<MAX_WINDOWS;win++)
if(Windows[win].data!=0L)HUnlock(Windows[win].data);
}
/****/
/**** UnLock the a windows information */
/****/
void TesterUnLockWindowInfoNum(win)
int win;
{
HUnlock(Windows[win].data);
}
/****/
/**** Get the window information attached to the current window */
/****/
unsigned char *TesterGetWindowInfo()
{
return (unsigned char *)*Windows[CurWindow].data;
}
/****/
/**** Get the window information with the identity of the window */
/****/
unsigned char *TesterGetWindowInfoIndirect(window)
WindowPtr window;
{
int win;
if ( ( win = TesterFindProgWindow(window) ) == (-1) ) return 0L;
return (unsigned char *)*Windows[win].data;
}
/****/
/**** Close a window */
/****/
void TesterKillWindow(win)
int win;
{
int ent;
DisposDialog(Windows[win].window);
Windows[win].window = 0L;
Windows[win].wStorage = 0L;
DisposHandle(Windows[win].data);
Windows[win].data = 0L;
Windows[win].handler = 0;
CurWindow=(-1);
}
/****/
/**** If there is a window bring it to the front and report */
/****/
int TesterOnlyOneHandler(handler)
int handler;
{
int win,wnum;
win=(-1);
for(wnum=0;wnum<MAX_WINDOWS;wnum++)
{
if(Windows[wnum].handler == handler)win=wnum;
}
if(win!=(-1))
{
SelectWindow(Windows[win].window);
return 1;
}
return 0;
}